/**
 * Created by chenyong on 2015/7/16.
 */

var express = require('express');
var passport = require('passport');
var auth = require('../auth.service');

var router = express.Router();


router.get('/',function(req,res,next){
  passport.authenticate('facebook', {
    scope: ['email', 'user_about_me'],
    session: false
  })(req, res, next);
});

router.get('/callback',
    passport.authenticate('facebook',
        {
          successRedirect:'/auth/success',
          failureRedirect: '/auth/failure',
          session:false
        }),
    auth.setTokenCookie
);

module.exports = router;